//
//  CreateFile.cpp
//  LearningOops
//
//  Created by Swetha Patnala on 4/14/13.
//  Copyright (c) 2013 Swetha Patnala. All rights reserved.
//

#include "CreateFile.h"
#include "File_System_Manager.h"
#include "Inode.h"




int Create_file::fs_create(char* name){
    
    // getting the inode counter
    File_System_Manager *file;
    file =  File_System_Manager::getInstance();
    int count = file->get_inodecounter();
    
    if( file->is_inode_full()){
        cout << " Cannot create a file since the inodes are full .No place to accomodate new inodes ";
        return -1;
    }
    
    
    Inode *create_inode = new Inode(count, name);
    create_inode->printInode();
    
    cout<< "Data Block Info after creating an inode"  <<endl;
    file->printSuperBlock();
    
    return 0;
};